/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package scubalogbook.gui.components;

import java.awt.*;
import javax.swing.*;
import java.io.*;

/**
 *
* @author vkorecky
 */
public class ImagePanel extends JPanel implements Serializable {
    Image image = null;
   
    public ImagePanel() {   
    }

    public ImagePanel(Image image) {
        this.image = image;
    }
  

    public void setImage(Image image){
        this.image = image;
    }
   
    public Image getImage(Image image){
        return image;
    }
   
    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g); //paint background
        if (image != null) { //there is a picture: draw it
            int height = image.getHeight(this);
            int width = image.getWidth(this);                     
            int top = this.getSize().height - height;            
            g.drawImage(image,0,top, width, height, this);
            //g.drawImage(image, 0, 0, this); //original image size
         }  //end if
    } //end paint
} //end class
